package com.sanjiahantang.youjiaclient.base;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.Window;
import android.view.WindowManager;

import com.sanjiahantang.uilibrary.adapter.DemoPagerAdapter;
import com.sanjiahantang.uilibrary.views.CircleIndicator;
import com.sanjiahantang.uilibrary.views.ImageFragment;
import com.sanjiahantang.youjiaclient.R;
import com.sanjiahantang.youjiaclient.module.common.views.impl.MainActivity;
import com.sanjiahantang.youjiaclient.utils.AppManager;


/**
 * 引导页
 * Created by sks on 2015/12/4.
 */
public class Guide extends FragmentActivity implements ImageFragment.IntentBack {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        //去掉标题栏，只去掉这一行不行，还有信息栏
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
        //去掉信息栏，设置全屏
        setContentView(R.layout.activity_guide);

        ViewPager defaultViewpager = (ViewPager) findViewById(R.id.viewpager_default);
        CircleIndicator defaultIndicator = (CircleIndicator) findViewById(R.id.indicator_default);
        DemoPagerAdapter defaultPagerAdapter = new DemoPagerAdapter(getSupportFragmentManager(),this);
        defaultViewpager.setAdapter(defaultPagerAdapter);
        defaultIndicator.setViewPager(defaultViewpager);
        AppManager.getAppManager().addActivity(Guide.this);

//        Uri uri = getIntent().getData();
//        if (uri != null) {
//            StringBuffer sb = new StringBuffer();
//            // 完整的url信息
//            sb.append("url: " + uri.toString());
//            // scheme部分
//            sb.append("\nscheme: " + uri.getScheme());
//            // host部分
//            sb.append("\nhost: " + uri.getHost());
//            // 访问路劲
//            sb.append("\npath: ");
//            List<String> pathSegments = uri.getPathSegments();
//            for (int i = 0; pathSegments != null && i < pathSegments.size(); i++) {
//                sb.append("/" + pathSegments.get(i));
//            }
//            // Query部分
//            sb.append("\nquery: ?" + uri.getQuery());
//
//            ToastUtil.showToast(this,sb.toString());
//        }

    }

    @Override
    public void getIntentCallBack() {
        Intent intent = new Intent(this,MainActivity.class);
        startActivity(intent);
        finish();
    }
}
